package com.api.regression.group.getgroups.bylist;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.test.context.ContextConfiguration;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import com.api.test.AbstractApiTest;
import com.zyncro.api.IGroupApiService;
import com.zyncro.api.exceptions.ZyncroApiException;
import com.zyncro.api.model.CollectionResultApi;
import com.zyncro.api.model.GroupApi;

@ContextConfiguration(locations = { "classpath:/group/group-context.xml" })
public class GetGroupsByListInvalid extends AbstractApiTest {

	@Value("#{staticgroups['user.external'].appId}")
	private String externalUserUrn;

	@Value("#{staticgroups['user.external'].password}")
	private String externalUserPassword;

	@Value("#{staticgroups['group.open.notMember.urn']}")
	private String openGroupUrn;

	@Value("#{staticgroups['group.personalFeed.urn']}")
	private String personalFeedUrn;

	@Value("#{staticgroups['group.companyFeed.urn']}")
	private String companyFeedUrn;

	@BeforeClass
	protected void loginUser() throws Exception {

		getApi().login(externalUserUrn, externalUserPassword);
	}

	@Test
	public void testGetGroups() throws ZyncroApiException {

		List<String> groups = new ArrayList<String>();

		groups.add(personalFeedUrn);
		groups.add(openGroupUrn);
		groups.add(companyFeedUrn);

		CollectionResultApi<GroupApi> result = getApi().getService(IGroupApiService.class).getGroupsById(groups);

		Assert.assertEquals(result.getElements().size(), 0, "Number of groups");
	}
}
